package com.xiaoxi.exam.utils;

import com.xiaoxi.exam.bean.BannerInfo;
import com.xiaoxi.exam.model.Banner;
import java.util.List;
import java.util.stream.Collectors;

public class BannerFactory {

  public static List<BannerInfo> toList(List<Banner> banners) {
    return banners.stream().map(BannerFactory::api).collect(Collectors.toList());
  }

  private static BannerInfo api(Banner banner) {
    BannerInfo info = new BannerInfo();
    info.setUrl(banner.getUrl());
    return info;
  }
}
